package com.douyinkan.controller;

import com.douyinkan.dto.ContentDTO;
import com.douyinkan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/user")
public class UserController {
    
    @Autowired
    private UserService userService;
    
    @GetMapping("/favorites")
    public ResponseEntity<List<ContentDTO>> getFavorites() {
        List<ContentDTO> favorites = userService.getFavoriteContents();
        return ResponseEntity.ok(favorites);
    }
    
    @GetMapping("/ratings")
    public ResponseEntity<List<ContentDTO>> getRatings() {
        List<ContentDTO> ratedContents = userService.getRatedContents();
        return ResponseEntity.ok(ratedContents);
    }
    
    @GetMapping("/history")
    public ResponseEntity<List<ContentDTO>> getHistory() {
        List<ContentDTO> history = userService.getViewHistory();
        return ResponseEntity.ok(history);
    }
}